Please can anyone advise whether it is possible to create string array, and then convert each array item to run as an executable command. |
Re: how do I execute a command that is currently of type string
You can use 'eval_' to execute a script, that can of course be only a single line. The interface is purely 'string' so you cannot send anything like an Object handle to eval_. eval_ can return a string value back to the calling program via the 'return_(string)' function; which stores the returned string until eval_ finishes naturally.
string myStringArrary[] = {"print \"Press 1\\n\"", "print \"Press 2\\n\""}
int i
for (i=0; i<sizeof(myStringArrary); i++)
eval_(myStringArrary[i])
|
Re: how do I execute a command that is currently of type string llandale - Mon Apr 26 17:25:11 EDT 2010
You can use 'eval_' to execute a script, that can of course be only a single line. The interface is purely 'string' so you cannot send anything like an Object handle to eval_. eval_ can return a string value back to the calling program via the 'return_(string)' function; which stores the returned string until eval_ finishes naturally.
string myStringArrary[] = {"print \"Press 1\\n\"", "print \"Press 2\\n\""}
int i
for (i=0; i<sizeof(myStringArrary); i++)
eval_(myStringArrary[i])
That worked !! I don't suppose you know of a solution for a similar problem do you: I have defined a series of filters (filter1, filter2, filter3...) I need to run each of these filters in turn. Would it be possible to create a string array with items: {"set filter1", "set filter2", "set filter3} Is there anyway that I would be able execute these array items as a command? If not, do you know of another solution to my problem? Thanks in advance |
Re: how do I execute a command that is currently of type string monde888 - Mon May 10 05:55:54 EDT 2010
I think you are asking: get several filters ready, and offer the user to select one and then another, and apply each on demand from the user.
DB dbFilt
DBE dbeFilts
void CalculateFilters()
{
Filter flt = null
//calculate flt for c_FiltLabels[0]
put(g_skpFilters, c_FiltLabels[0], flt)
//calculate flt for c_FiltLabels[1]
put(g_skpFilters, c_FiltLabels[1], flt)
//calculate flt for c_FiltLabels[2]
put(g_skpFilters, c_FiltLabels[2], flt)
}
void clbkFilts(DBE dbeXX)
{ // Callback fires when user selects a Filter
int iFilt = get(dbeFilts)
string Label
Filter flt
if (iFilt < 0) return // this is impossible
Label = c_FiltLabels[iFilt]
infoBox("Dealing with filter '" Label "'")
find(g_skpFilters,Label, flt)
// now apply flt to the module
}
void applyClose(DB dbXX)
{ delete(g_skpFilters)
hide(dbFilt)
destroy(dbFilt)
}
void MakeDialog()
{
g_skpFilters = createString()
CalculateFilters()
dbFilt = create("Choose Filters")
dbeFilts = verticalRadioBox(dbFilt, "Filters", c_FiltLabels, -1)
set(dbeFilts, clbkFilts) // Callback fires when user selects filter
close(dbFilt, true, applyClose)
realize(dbFilt)
show(dbFilt)
}
MakeDialog()
|
Re: Oops, full DXL llandale - Mon May 10 12:24:04 EDT 2010
I think you are asking: get several filters ready, and offer the user to select one and then another, and apply each on demand from the user.
DB dbFilt
DBE dbeFilts
void CalculateFilters()
{
Filter flt = null
//calculate flt for c_FiltLabels[0]
put(g_skpFilters, c_FiltLabels[0], flt)
//calculate flt for c_FiltLabels[1]
put(g_skpFilters, c_FiltLabels[1], flt)
//calculate flt for c_FiltLabels[2]
put(g_skpFilters, c_FiltLabels[2], flt)
}
void clbkFilts(DBE dbeXX)
{ // Callback fires when user selects a Filter
int iFilt = get(dbeFilts)
string Label
Filter flt
if (iFilt < 0) return // this is impossible
Label = c_FiltLabels[iFilt]
infoBox("Dealing with filter '" Label "'")
find(g_skpFilters,Label, flt)
// now apply flt to the module
}
void applyClose(DB dbXX)
{ delete(g_skpFilters)
hide(dbFilt)
destroy(dbFilt)
}
void MakeDialog()
{
g_skpFilters = createString()
CalculateFilters()
dbFilt = create("Choose Filters")
dbeFilts = verticalRadioBox(dbFilt, "Filters", c_FiltLabels, -1)
set(dbeFilts, clbkFilts) // Callback fires when user selects filter
close(dbFilt, true, applyClose)
realize(dbFilt)
show(dbFilt)
}
MakeDialog()
Oops. Snipped off the top of the DXL.
Skip g_skpFilters //KEY: 'string' Label of Filter; DATA: 'Filter'
string c_FiltLabels[] = {
"Filter 1",
"Filter 2",
"Filter 3"
}
DB dbFilt
DBE dbeFilts
void CalculateFilters()
{
Filter flt = null
//calculate flt for c_FiltLabels[0]
put(g_skpFilters, c_FiltLabels[0], flt)
//calculate flt for c_FiltLabels[1]
put(g_skpFilters, c_FiltLabels[1], flt)
//calculate flt for c_FiltLabels[2]
put(g_skpFilters, c_FiltLabels[2], flt)
}
void clbkFilts(DBE dbeXX)
{ // Callback fires when user selects a Filter
int iFilt = get(dbeFilts)
string Label
Filter flt
if (iFilt < 0) return // this is impossible
Label = c_FiltLabels[iFilt]
infoBox("Dealing with filter '" Label "'")
find(g_skpFilters,Label, flt)
// now apply flt to the module
}
void applyClose(DB dbXX)
{ delete(g_skpFilters)
hide(dbFilt)
destroy(dbFilt)
}
void MakeDialog()
{
g_skpFilters = createString()
CalculateFilters()
dbFilt = create("Choose Filters")
dbeFilts = verticalRadioBox(dbFilt, "Filters", c_FiltLabels, -1)
set(dbeFilts, clbkFilts) // Callback fires when user selects filter
close(dbFilt, true, applyClose)
realize(dbFilt)
show(dbFilt)
}
MakeDialog()
|